package com.mtiiot.fstcpserver.fastdfs.core;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Socket;

public class ServerInfo
{
  protected String ip_addr;
  protected int port;

  public ServerInfo(String ip_addr, int port)
  {
    this.ip_addr = ip_addr;
    this.port = port;
  }

  public String getIpAddr()
  {
    return this.ip_addr;
  }

  public int getPort()
  {
    return this.port;
  }

  public Socket connect()
    throws IOException
  {
    Socket sock = new Socket();
    sock.setReuseAddress(true);
    sock.setSoTimeout(ClientGlobal.g_network_timeout);
    sock.connect(new InetSocketAddress(this.ip_addr, this.port), ClientGlobal.g_connect_timeout);
    return sock;
  }
}